<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SHOP 管理中心 - 管理员管理 </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/admin/styles/general.css" rel="stylesheet" type="text/css" />
<link href="/admin/styles/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>
<span class="action-span"></span>
<span class="action-span1">SHOP 管理中心 </span><span id="search_id" class="action-span1">--给 <font color="red">{{$admin_one->admin_name}}</font> 分配权限</span>
<div style="clear:both"></div>
</h1>

<form method="post" action="http://www.nbshop.com/admin/add_Node" name="listForm">
<!-- start brand list -->
<div class="list-div" id="listDiv">
<input type="hidden" value="{{$admin_one->admin_id}}" name="admin_id" />
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
  <table>
        <tr>
            <td>可分配列表</td>
            <td>
                <table>
                <?php foreach ($nodeList as $key => $value): ?>
                <tr>
                    <td>
                        <input type="checkbox" name="node_id[]" value="<?php echo $value['node_id'] ?>" class="parent"
                        <?php if ($value['checked']==1): ?>
                             checked='checked'
                        <?php endif ?>
                         ><font color="red"><?php echo $value['node_title'] ?></font>
                    </td>
                    <?php foreach ($value['child'] as $key => $val): ?>
                        <td>
                            <input type="checkbox" name="node_id[]" value="<?php echo $val['node_id'] ?>" class="child"   <?php if ($val['checked']==1): ?>
                             checked='checked'
                        <?php endif ?>
                        ><?php echo $val['node_title'] ?></td>
                   <?php endforeach ?>
                </tr>
                <?php endforeach ?>
                </table>
            </td>
        </tr>
        <tr>
          <td colspan="2" align="center"><br>
            <input type="submit" class="button" value=" 确定 ">
            <input type="reset" class="button" value=" 重置 ">
          </td>
        </tr>
 
  </table>

<!-- end brand list -->
</div>
</form>
</body>
</html>
<script src="/admin/js/jquery.js"></script>
<script>
    //父选子
      $(".parent").click(function(){
        $(this).parent().parent().find(".child").prop("checked",$(this).prop("checked"));
      });
      //子选父
      $(".child").click(function(){
        if($(this).prop("checked")){
          $(this).parent().parent().find(".parent").prop("checked",true);
        }else{
          // if($(this).parent().find(":checked").size()==0){
          //   $(this).parent().parent().find(".parent").prop("checked",false);
          // }
        }
    })
</script>